package cn.shop.admin.controller;

import cn.shop.admin.entity.UniversalModule.CityVO;
import cn.shop.admin.service.UniversalService;
import cn.shop.utils.ApiResult;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

/**
 * 通用接口
 *
 * @author jzw
 * @since 2021-11-05 13:07
 */
@Validated
@RestController
@RequestMapping("/api/v1/universal")
public class UniversalController {

	@Resource
	private UniversalService universalService;

	/**
	 * 获取城市树
	 *
	 * @return cn.shop.utils.ApiResult<cn.shop.admin.entity.UniversalModule.CityVO>
	 * @author jzw
	 * @since 2021/11/5 13:15
	 */
	@GetMapping("cityTree")
	public ApiResult<List<CityVO>> getCityTree(Long id) {
		return ApiResult.success(universalService.getCityTree(id));
	}

}
